Skip to content

[fix][cpp-client] Pass seek error to callback when SEEK command fails#549

Open
zhanglistar wants to merge 7 commits intoapache:mainfrom
bigo-sg:fix/issue-528
Open

[fix][cpp-client] Pass seek error to callback when SEEK command fails#549
zhanglistar wants to merge 7 commits intoapache:mainfrom
bigo-sg:fix/issue-528

Conversation

@zhanglistar
Copy link
Copy Markdown
Contributor

@zhanglistar zhanglistar commented Mar 8, 2026

Fixes #528

Motivation

In ConsumerImpl::seekAsyncInternal, when the broker responds to the SEEK request with a non-OK result, we reset seek state and invoke the user seekCallback_ on the executor. The failure path incorrectly called callback(ResultOk), so callers could observe success even though the seek had failed.

Modifications

  • In the result != ResultOk branch of the SEEK response handler, change the posted callback from callback(ResultOk) to callback(result) (capture result in the lambda and forward the actual error code).

Verifying this change

  • CI passes.

Seek failure is now surfaced with the correct Result code to seekAsync / synchronous seek callers.

Documentation

  • doc-not-needed

Internal bug fix; no API or user-facing behavior contract change beyond reporting the correct error on seek failure.

@BewareMyPower BewareMyPower added this to the 4.1.0 milestone Mar 17, 2026
zhangzhibiao added 2 commits March 21, 2026 21:28
Comment on lines +1849 to +1850
executor_->postWork([self, callback{std::exchange(seekCallback_, std::nullopt).value()},
result]() { callback(result); });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this PR is no longer fixing testHasMessageAvailableAfterSeekToEnd but just to propagate the correct error from seek response. Could you update the PR title?

Copy link
Copy Markdown
Contributor Author

@zhanglistar zhanglistar Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, done.

@zhanglistar zhanglistar changed the title [Test] Fix flaky test: ReaderSeekTest.testHasMessageAvailableAfterSeekToEnd [fix][cpp-client] Pass seek error to callback when SEEK command fails Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Flaky test: ReaderSeekTest.testHasMessageAvailableAfterSeekToEnd

2 participants